package com.cindata

import com.opencsv.CSVReader
import com.opencsv.bean.ColumnPositionMappingStrategy
import com.opencsv.bean.CsvToBean
import com.opencsv.bean.CsvToBeanBuilder;

class EstateCSVImporter extends CSVImpoter
{

    /*******************按照实体将csv对应的列进行排序列出*******************************/
    static columnsSet = [
        [ name: 'externalId'],
        [ name: 'buildingType'],
        [ name: 'estateStatus'],
        [ name: 'cityName'],
        [ name: 'districtName'],
        [ name: 'address'],
        [ name: 'buildArea'],
        [ name: 'totalFloor'],
        [ name: 'currentFloor'],
        [ name: 'contractNo'],
        [ name: 'startDate',type: 'Date'],
        [ name: 'loansEvaluateTotalPrice'],
        [ name: 'loansEvaluatePrice'],
        [ name: 'loansAmount'],
        [ name: 'ltv'],
        [ name: 'loansBalance'],
        [ name: 'endDate',type: 'Date'],
        [ name: 'mortgageeName'],
        [ name: 'estateType'],
        [ name: 'accountName'],
        [ name: 'isFirstHouse'],
        [ name: 'downPaymentAmount'],
        [ name: 'publicFundLoansAmount'],
        [ name: 'bankLoansAmount'],
        [ name: 'loansBankName'],
        [ name: 'loansDuration'],
        [ name: 'starRepaymentMode'],
        [ name: 'repaymentDate'],
        [ name: 'forwardLoanStep'],
        [ name: 'loanMethod'],
        [ name: 'curRepaymentMode'],
        [ name: 'curRecycleTotalCapital'],
        [ name: 'curRecycleTotalInterest'],
        [ name: 'curRecycleTotalFine'],
        [ name: 'curHasPaymentTODuration'],
        [ name: 'curHasPaymentDuration'],
        [ name: 'remainTime'],
        [ name: 'guaranteeMethod'],
        [ name: 'guaranteeInstitution'],
        [ name: 'borrPublicFundAccount'],
        [ name: 'borrName'],
        [ name: 'borrPhone'],
        [ name: 'borrIdCardNo'],
        [ name: 'borrBirthday',type: 'Date'],
        [ name: 'borrAccountNature'],
        [ name: 'borrOwnHouseCount'],
        [ name: 'borrWorkUnitName'],
        [ name: 'borrWorkUnitNature'],
        [ name: 'borrDepositedState'],
        [ name: 'borrDepositBaseOnLoans'],
        [ name: 'borrDepositAmountOnLoans'],
        [ name: 'borrDepositBaseOnCurrent'],
        [ name: 'borrDepositAmountOnCurrent'],
        [ name: 'borrFmiOnLoans'],
    ]
    /*******************读取单个单元格数据**********************/

    EstateCSVImporter(){
        columns = columnsSet
        startRow = 3
    }

    @Override
    def read(InputStream inputStream,String charsetName) {
        return super.read(inputStream,charsetName)
    }
}
